﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CYTools.Models.Model;
using System.Configuration;
using CYTools.Util;
using System.Data;
using System.Data.SqlClient;
using CYTools.Models.Dao;

namespace CYTools.Models.Service
{
    public class ProjectInfoService
    {
        public SqlConnection conn = null;
        public SqlTransaction stran = null;
        public Database db = new Database();
        /// <summary>
        /// 获取工程信息
        /// </summary>
        /// <returns></returns>
        public List<ProjectInfo> getPjInfoList()
        {
            try
            {
                conn = db.GetConn();
                conn.Open();
                ProjectInfoDao pjDao = new ProjectInfoDao();
                List<ProjectInfo> uinfo = pjDao.getPjInfoList(conn);
                return uinfo;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                db.CloseConnection(conn);
            }
        }
        /// <summary>
        /// 获取工程门窗信息
        /// </summary>
        /// <returns></returns>
        public List<ProjectWindow> getPjwInfoList(string Gcxx_id)
        {
            try
            {
                conn = db.GetConn();
                conn.Open();
                ProjectInfoDao pjDao = new ProjectInfoDao();
                List<ProjectWindow> uinfo = pjDao.getPjwInfoList(conn, Gcxx_id);
                return uinfo;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                db.CloseConnection(conn);
            }
        }
        /// <summary>
        /// 获取工程门窗详细信息
        /// </summary>
        /// <returns></returns>
        public List<ProjectWindowDetail> getPjwDInfoList(string Gcmc_id)
        {
            try
            {
                conn = db.GetConn();
                conn.Open();
                ProjectInfoDao pjDao = new ProjectInfoDao();
                List<ProjectWindowDetail> uinfo = pjDao.getPjwDInfoList(conn, Gcmc_id);
                return uinfo;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                db.CloseConnection(conn);
            }
        }
        /// <summary>
        /// 获取工程门窗明细型材下料
        /// </summary>
        /// <returns></returns>
        public List<XcXlInfo> getXcXlInfoList(string Mcmx_id)
        {
            try
            {
                conn = db.GetConn();
                conn.Open();
                ProjectInfoDao PjDao = new ProjectInfoDao();
                List<XcXlInfo> uinfo = PjDao.getXcXlInfoList(conn, Mcmx_id);
                return uinfo;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                db.CloseConnection(conn);
            }
        }
        /// <summary>
        /// 获取工程门窗明细配件下料
        /// </summary>
        /// <returns></returns>
        public List<PjXlInfo> getPjXlInfoList(string Mcmx_id)
        {
            try
            {
                conn = db.GetConn();
                conn.Open();
                ProjectInfoDao PjDao = new ProjectInfoDao();
                List<PjXlInfo> uinfo = PjDao.getPjXlInfoList(conn, Mcmx_id);
                return uinfo;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                db.CloseConnection(conn);
            }
        }
        /// <summary>
        /// 获取工程门窗明细玻璃下料
        /// </summary>
        /// <returns></returns>
        public List<BlXlInfo> getBlXlInfoList(string Mcmx_id)
        {
            try
            {
                conn = db.GetConn();
                conn.Open();
                ProjectInfoDao PjDao = new ProjectInfoDao();
                List<BlXlInfo> uinfo = PjDao.getBlXlInfoList(conn, Mcmx_id);
                return uinfo;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                db.CloseConnection(conn);
            }
        }
    }
}
